package com.hulk.ratel.manage.transactionservice;


import com.hulk.ratel.common.util.DateUtil;
import com.hulk.ratel.persistence.entity.LogNotify;
import com.hulk.ratel.persistence.entity.LogNotifyRecord;
import com.hulk.ratel.persistence.entity.LogTxnPayRecord;
import com.hulk.ratel.persistence.repository.ILogNotifyRecordRepository;
import com.hulk.ratel.persistence.repository.ILogNotifyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: hulk
 * @E-mail: 29572320@qq.com
 * @Date: Create in 2018/9/21 下午5:10
 * @Version: 1.0.0
 * @Modify by:
 * Class description
 */
@Component
public class RetryNotifyRecordTransactionService {

    @Autowired
    protected ILogNotifyRecordRepository logNotifyRecordRepository;

    @Autowired
    private ILogNotifyRepository logNotifyRepository;

    @Transactional
    public void ModifyNotifyRecord(LogNotifyRecord notifyRecord, LogNotify notify, LogTxnPayRecord record, String result, String status, int times) {
        notifyRecord.setRespTime(DateUtil.getDateyyyyMMddHHmmss());
        notifyRecord.setRespMsg(result);
        notifyRecord.setStatus(status);
        logNotifyRecordRepository.updateById(notifyRecord);
        notify.setNotifyCount(times);
        notify.setStatus(status);
        logNotifyRepository.updateById(notify);

    }
}
